//
//  A_4ViewController.m
//  RACExamale
//
//  Created by cym_bj on 2017/11/29.
//  Copyright © 2017年 com.cym. All rights reserved.
//

#import "A_4ViewController.h"
#import <ReactiveObjC/ReactiveObjC.h>
@interface A_4ViewController ()

@end

@implementation A_4ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title=@"RACReplaySubject";
    
    
    /*
     
     RACReplaySubject :可以先发送信号 ，在订阅信号
    
     
     */
    
    RACReplaySubject *replaySubject= [RACReplaySubject subject];
    
    [replaySubject sendNext:@"哈哈,发送数据"];
    [replaySubject sendNext:@2];
    
    [replaySubject subscribeNext:^(id  _Nullable x) {
        
        NSLog(@"第一个订阅者接收到的数据%@",x);
        
    }];
    
    [replaySubject subscribeNext:^(id  _Nullable x) {
        
        NSLog(@"第二个订阅者接收到的数据%@",x);
        
    }];
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
